#include <iostream>
#include <cstdio>
using namespace std;

int main() {
    int n;
    cin >> n;

    int cnt = 0;
    int maxv = 0;
    for (int i = 0; i < 32; ++i)
    {
        if (n & (1 << i))
            ++cnt;
        else
            cnt = 0;
        maxv = max(maxv, cnt);
    }
    cout << maxv << endl;
    return 0;
}